<template>
	<!-- 其他费用列表 -->
	<view class="c-row-box" v-if="addons.length > 0">
		<view class="c-row-head">
			<view class="c-row-title">项目列表</view>
		</view>
		<view class="panel-body">
			<view class="other-list">
				<view class="row">
					<view class="col">
						<view>项目类型</view>
					</view>
					<view class="col">
						<view>项目数量</view>
					</view>
					<view class="col">
						<view>项目价格</view>
					</view>
					<view class="col">
						<view>项目小计</view>
					</view>
					<view class="col">
						<view>操作</view>
					</view>
				</view>
				<view class="row" v-for="(item,index) in addons" :key="index">
					<view class="col">
						<view class="col-item-text">{{item.other_name ? item.other_name : item.tag_title}}</view>
					</view>
					<view class="col">
						<view>{{item.amount}}</view>
					</view>
					<view class="col">
						<view>{{item.price}}</view>
					</view>
					<view class="col">
						<view>{{item.total}}</view>
					</view>
					<view class="col">
						<text class="action-text primary" @click="editOtherList(item)">查看</text>
						<text class="action-text remove" @click="deleteOtherItem(index)" v-if="!isPreview">删除</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			isPreview: {
				type: Boolean,
				default(){
					return false
				}
			},
			addons: {
				type: Array,
				default () {
					return []
				}
			}
		},
		data() {
			return {

			};
		},
		methods: {
			// 删除已添加的其他费用
			deleteOtherItem(index) {
				this.$emit('deleteOtherItem', index)
			},

			// 查看信息
			editOtherList(data) {
				this.$emit('editOtherList',data)
			},
		}
	}
</script>

<style lang="less">
	@import url('../../../order/createOrder/components/common.less');
	@import url('../../../order/components/common.less');
</style>
